// 下载中心
export const tableColumns = context => {
  return [
    {
      prop: 'fileName',
      label: '报表名称',
      minWidth: 120
    },
    {
      prop: 'operator',
      label: '导出人',
      minWidth: 120
    },
    // {
    //   prop: 'downloadTimes',
    //   label: '下载次数',
    //   minWidth: 180
    // },
    {
      prop: 'createTime',
      label: '导出时间',
      minWidth: 120
    },
    {
      button: true,
      label: '操作',
      fixed: 'right',
      minWidth: 100,
      render: (h, row) => {
        const loading = false
        const getBtn = (txt, funType) => {
          return (
            <el-button
              type="text"
              onClick={() => context.onOperateClick(funType, row, loading)}
            >
              {txt}
            </el-button>
          )
        }
        const downBtn = getBtn('下载', 'down')
        const delBtn = getBtn('删除', 'del')
        if (+row.status === 1) {
          return [downBtn, delBtn]
        } else {
          return (
            <el-button type="text" loading="loading">
              生成中...
            </el-button>
          )
        }
      }
    }
  ]
}
